import { Component } from 'react'
import { View } from '@tarojs/components'
import "taro-ui/dist/style/components/search-bar.scss";
import "taro-ui/dist/style/components/icon.scss";
import "taro-ui/dist/style/components/button.scss" // 按需引入i
import Taro　from '@tarojs/taro';
import { AtTabBar} from 'taro-ui'
import "taro-ui/dist/style/components/tab-bar.scss";
import "taro-ui/dist/style/components/badge.scss";
import "taro-ui/dist/style/components/icon.scss";
import {BASEURL} from "../../constants/global";
export default class TabBar extends Component {
  constructor(){
    super(...arguments)
    this.state = {
      current:this.props.current
    }
  }
  handleClick(value){
   switch(value){
     case 0:{
       Taro.reLaunch({url:'/pages/index/index'});
       break;
     }
     case 2:{
       Taro.reLaunch({url:'/pages/index/healthimf'})
     }
   }
  }
    render () {
      return (
        <View className="TabBar">
          <AtTabBar
              fixed
              color='#cccccc'
              selectedColor='#d40000'
              tabList={[
                { title: '首页', image: `${BASEURL}home.png`, selectedImage: `${BASEURL}homeSelected.png` },
                { title: '今日热点', image: `${BASEURL}knowledge.png`, selectedImage: `${BASEURL}knowledgeSelected.png` },
                { title: '健康档案', image: `${BASEURL}health.png`, selectedImage: `${BASEURL}healthSelected.png` },
                { title: '我的', image: `${BASEURL}self.png`, selectedImage:`${BASEURL}selfSelected.png` }
              ]}
              onClick={this.handleClick.bind(this)}
              current={this.state.current}
          />
        </View>
      )
    }
  }